package com.cwj.proxy;

/**
 * @author chenwujie
 * @date 2020-12-30 14:41
 */
public class HelloProxy implements Hello {
    private Hello hello;

    public HelloProxy(Hello hello){
        this.hello = hello;
    }

    @Override
    public String hello() {
        System.out.println("前：");
        String result = this.hello.hello();
        System.out.println("result: " + result);
        System.out.println("后：");
        return result;
    }

    public static void main(String[] args) {
        Hello hello = new HelloImpl();
        HelloProxy helloProxy = new HelloProxy(hello);
        helloProxy.hello();
    }
}
